import request from '@/utils/request'


// 获得表定义分页
export function getCodegenTablePage(query) {
  return request({
    url: '/infra/info-table-collect/page',
    method: 'get',
    params: query
  })
}

// 获得表定义分页
export function getSchemaTableList(query) {
  return request({
    url: '/infra/info-table-collect/db/table/list',
    method: 'get',
    params: query
  })
}


// 基于数据库的表结构，创建代码生成器的表定义
export function createCodegenList(data) {
  return request({
    url: '/infra/info-table-collect/create-list',
    method: 'post',
    data: data
  })
}

// 删除数据库的表和字段定义
export function deleteCodegen(tableId) {
  return request({
    url: '/infra/info-table-collect/delete?tableId=' + tableId,
    method: 'delete'
  })
}

// 创建基础资料表汇总
export function createInfoTableCollect(data) {
  return request({
    url: '/infra/info-table-collect/create',
    method: 'post',
    data: data
  })
}

// 更新基础资料表汇总
export function updateInfoTableCollect(data) {
  return request({
    url: '/infra/info-table-collect/update',
    method: 'put',
    data: data
  })
}

// 删除基础资料表汇总
export function deleteInfoTableCollect(id) {
  return request({
    url: '/infra/info-table-collect/delete?id=' + id,
    method: 'delete'
  })
}

// 获得基础资料表汇总
export function getInfoTableCollect(id) {
  return request({
    url: '/infra/info-table-collect/get?id=' + id,
    method: 'get'
  })
}

// 获得基础资料表汇总分页
export function getInfoTableCollectPage(query) {
  return request({
    url: '/infra/info-table-collect/page',
    method: 'get',
    params: query
  })
}

// 导出基础资料表汇总 Excel
export function exportInfoTableCollectExcel(query) {
  return request({
    url: '/infra/info-table-collect/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获得表和字段的明细
export function getCodegenDetail(tableId) {
  return request({
    url: '/infra/info-table-collect/detail?tableId=' + tableId,
    method: 'get',
  })
}
